package com.fj.controller;

import com.fj.service.EmailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.File;

@Api(value = "邮箱测试")
@Controller
public class EmailController {

    @Autowired
    private EmailService emailService;

    @ResponseBody
    @RequestMapping(value = "/stringEmaile",method = RequestMethod.GET)
    public String sendStringEmail(){
        emailService.sendStringEmail("2377013302@qq.com","你好,黄明宇先生","记得还钱");
        return "发送成功";
    }

    @ResponseBody
    @RequestMapping(value = "/bigEmail",method = RequestMethod.GET)
    public String sendBigEmail(){
        File file = new File("static/beauty_20190802153459.jpg");
        emailService.sendBigEmail("1779540383@qq.com","柒宝宝，美图请查收","特别漂亮的哦！",file);
        return "发送成功";
    }

    @ResponseBody
    @RequestMapping(value = "/templateEmail",method = RequestMethod.GET)
    public String sendTemplateEmail(){
        //emailService.sendTemplateEmail("mmmmmm@qq.com","激活邮件","freemarkerTemplate.html");
        emailService.sendTemplateEmail("2377013302@qq.com","激活邮件","thymeleafTemplate.html");
        return "发送成功";
    }
}
